package org.social.controller;

import com.sojoys.artifact.core.IServer;
import com.sojoys.artifact.plugin.netty.web.NettyWebPlugin;
import com.sojoys.artifact.third.web.core.NettyHttpContext;
/**
 * 停止服务器
 * @author win7
 *
 */
public class ShutdownServer {
	/**
	 * 停止游戏服务器
	 * @param ctx
	 * @return
	 */
	public void stop(NettyHttpContext ctx) {
		System.out.println("----------------- server stop -----------------");
		NettyWebPlugin nettyWebPlugin = (NettyWebPlugin) IServer.getPlugins().getByName(NettyWebPlugin.class.getSimpleName());
		if(IServer.stop()){
			ctx.send("Succeed");
			ctx.finish();
			nettyWebPlugin.shutdown();
		}else {
			ctx.send("Failure");
			ctx.finish();
		}
	}
}